@echo off
echo ====================================
echo SSO SDK 修复验证脚本
echo ====================================
echo.

echo 1. 检查JDK版本...
java -version
echo.

echo 2. 检查Maven环境...
if exist "%MAVEN_HOME%\bin\mvn.cmd" (
    "%MAVEN_HOME%\bin\mvn.cmd" -version
    set MVN_CMD="%MAVEN_HOME%\bin\mvn.cmd"
) else if exist "C:\Program Files\Apache Software Foundation\maven\bin\mvn.cmd" (
    "C:\Program Files\Apache Software Foundation\maven\bin\mvn.cmd" -version
    set MVN_CMD="C:\Program Files\Apache Software Foundation\maven\bin\mvn.cmd"
) else (
    where mvn > nul 2>&1
    if !errorlevel! == 0 (
        mvn -version
        set MVN_CMD=mvn
    ) else (
        echo Maven not found! Please install Maven or set MAVEN_HOME
        pause
        exit /b 1
    )
)
echo.

echo 3. 清理项目...
%MVN_CMD% clean
if errorlevel 1 (
    echo 清理失败!
    pause
    exit /b 1
)
echo.

echo 4. 编译项目...
%MVN_CMD% compile
if errorlevel 1 (
    echo 编译失败! 请检查错误信息
    pause
    exit /b 1
) else (
    echo 编译成功!
)
echo.

echo 5. 运行测试...
%MVN_CMD% test
if errorlevel 1 (
    echo 测试失败! 请检查错误信息
    pause
    exit /b 1
) else (
    echo 测试成功!
)
echo.

echo 6. 生成jar包...
%MVN_CMD% package -DskipTests
if errorlevel 1 (
    echo 打包失败! 请检查错误信息
    pause
    exit /b 1
) else (
    echo 打包成功!
)
echo.

echo ====================================
echo SSO SDK 修复验证完成!
echo 所有检查都通过了。
echo ====================================
pause